<form id="frm_add" method="post" accept-charset="utf-8" action="<?php print $active; ?>">
<div>
    <table style="margin: auto;">
        <tbody>
            <tr>
                <td><label for="code"><?php print lang('vt_mavt'); ?></label></td>
                <td><input type="text" name="code" value="<?php print ( isset($vt) )? $vt->code : ''; ?>" class="itext ivalidate ui-widget-content ui-corner-all" /></td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_code" class="error"></div></td>
            </tr>
            
            <tr>
                <td><label for="name"><?php print lang('vt_tenvt'); ?></label></td>
                <td><input type="text" name="name" value="<?php print ( isset($vt) )? $vt->name : ''; ?>" class="itext ivalidate ui-widget-content ui-corner-all" /></td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_name" class="error"></div></td>
            </tr>
            
            <tr>
                <td><label for="total"><?php print lang('vt_soluongton'); ?></label></td>
                <td><input type="text" name="total" value="<?php print ( isset($vt) )? decimal_format($vt->total) : ''; ?>" class="input-number itext ivalidate ui-widget-content ui-corner-all" /></td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_total" class="error"></div></td>
            </tr>
            
            <tr>
                <td><label for="total"><?php print lang('vt_dongia'); ?></label></td>
                <td><input type="text" name="price" value="<?php print ( isset($vt) )? decimal_format($vt->price) : ''; ?>" class="input-number itext ivalidate ui-widget-content ui-corner-all" /></td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_price" class="error"></div></td>
            </tr>
            
            <tr>
                <td><label for="unit_id"><?php print lang('vt_donvitinh'); ?></label></td>
                <td>
                    <select name="unit_id" class="itext ui-widget-content ui-corner-all">
                    <?php if( count($dvt) > 0 ): ?>
                        <?php foreach($dvt As $val): ?>
                        <option value="<?php print $val->id; ?>" <?php print ( isset($vt) && ($val->id == $vt->unit_id) ) ? 'selected="selected"':''; ?>><?php print $val->name; ?></option>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <option value="0">...</option>
                    <?php endif; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_unit_id" class="error"></div></td>
            </tr>
            <tr>
                <td><label for="catg"><?php print lang('vt_tenphanloai'); ?></label></td>
                <td>
                    <select name="catg_id" class="itext ui-widget-content ui-corner-all">
                    <?php if( count($category) > 0 ): ?>
                        <?php foreach($category As $catg): ?>
                        <option value="<?php print $catg->id; ?>" <?php print ( isset($vt) && ($catg->id == $vt->catg_id) ) ? 'selected="selected"':''; ?>><?php print $catg->name; ?></option>
                        <?php endforeach; ?>
                    <?php else: ?>
                        <option value="0">...</option>
                    <?php endif; ?>
                    </select>
                </td>
            </tr>
            <tr>
                <td colspan="2"><div id="error_catg_id" class="error"></div></td>
            </tr>
            <tr>
                <td><label for="status"><?php print lang('vt_trangthai'); ?></label></td>
                <td>
                    <select name="status" class="itext ui-widget-content ui-corner-all">
                        <option value="1" <?php print ( isset($vt) && $vt->status == 1 ) ? 'selected="selected"':''; ?>><?php print lang('vt_tt_active'); ?></option>
                        <option value="2" <?php print ( isset($vt) && $vt->status == 2 ) ? 'selected="selected"':''; ?>><?php print lang('vt_tt_disable'); ?></option>
                        <?php if( isset($dvt) && $dvt->status == -1 ): ?>
                        <option value="-1" <?php print ( isset($vt) && $vt->status == -1 ) ? 'selected="selected"':''; ?>><?php print lang('vt_tt_delete'); ?></option>
                        <?php endif; ?>
                    </select>
                </td>
            </tr>
        </tbody>
    </table>
    <?php if( isset($vt) ): ?>
    <input type="hidden" name="id" value="<?php print $vt->id; ?>">
    <?php endif; ?>
</div>
</form>